﻿//-----------------------------------------------------------------------
// <copyright file="Copyright.cs" author="Michael Herndon">
//     Copyright (c) Michael Herndon.  All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace Amplify.Twitter
{
	using System;
	using System.Collections.Generic;
	using System.Linq;
	using System.ServiceModel;
	using System.ServiceModel.Web;
	using System.Text;

	/// <summary>
	/// Contract for twitter DirectMessage client
	/// </summary>
	[ServiceContract]
	public interface IDirectMessageClient
	{

		/// <summary>
		/// Gets an array of the direct messages sent <em>to</em> the user.
		/// </summary>
		/// <param name="page">The page number (for paging). </param>
		/// <param name="since">Specify a search date for all the friends that have joined since.  </param>
		/// <param name="sinceId">Specify a integer for all ids to be greater than. </param>
		/// <returns>returns an array of <see cref="Amplify.Twitter.DirectMessage"/>. </returns>
		/// <exception cref="System.ServiceModel.Security.MessageSecurityException" />
		///	<exception cref="Amplify.Twitter.TwitterException"> Throws when a twitter error occurs. </exception>
		[OperationContract,
			WebInvoke(
				BodyStyle = WebMessageBodyStyle.Bare,
				ResponseFormat = WebMessageFormat.Json,
				UriTemplate = "/direct_messages.json?page={page}&sinceId={sinceId}&since={since}")]
		DirectMessage[] GetList(int page, int sinceId, string since);

		/// <summary>
		/// Gets an array of the direct messages sent <em>by</em> the user.
		/// </summary>
		/// <param name="page">The page number (for paging). </param>
		/// <param name="since">Specify a search date for all the friends that have joined since.  </param>
		/// <param name="sinceId">Specify a integer for all ids to be greater than. </param>
		/// <returns>returns an array of <see cref="Amplify.Twitter.DirectMessage"/>. </returns>
		/// <exception cref="System.ServiceModel.Security.MessageSecurityException" />
		///	<exception cref="Amplify.Twitter.TwitterException"> Throws when a twitter error occurs. </exception>
		
		[OperationContract,
			WebInvoke(
				BodyStyle = WebMessageBodyStyle.Bare,
				ResponseFormat = WebMessageFormat.Json,
				UriTemplate = "/direct_messages/sent.json?page={page}&sinceId={sinceId}&since={since}")]
		DirectMessage[] GetSentList(int page, int sinceId, string since);


		/// <summary>
		/// Creates a Direct Message to the specified user.
		/// </summary>
		/// <param name="id">The screen name or user id of whom you want to send the message to.</param>
		/// <param name="text">The textual content of what you wish to send.</param>
		/// <returns>returns a <see cref="Amplify.Twitter.DirectMessage"/> object.</returns>
		/// <exception cref="System.ServiceModel.Security.MessageSecurityException" />
		/// <exception cref="Amplify.Twitter.TwitterException"> The text can not be longer than 140 characters. </exception>
		[OperationContract,
			WebInvoke(
				BodyStyle = WebMessageBodyStyle.Bare,
				ResponseFormat = WebMessageFormat.Json,
				UriTemplate = "/direct_messages/new.json?user={id}&text={text}")]
		DirectMessage Create(string id, string text);
		/// <summary>
		/// Destroys only a Direct Message <strong>sent by another user to the current user</strong>.
		/// </summary>
		/// <param name="messageId">The id of the specified message to be deleted.</param>
		/// <returns>returns a <see cref="Amplify.Twitter.DirectMessage"/> object. </returns>
		/// <exception cref="System.ServiceModel.Security.MessageSecurityException" />
		///	<exception cref="Amplify.Twitter.TwitterException"> Throws when a twitter error occurs. </exception>
		[OperationContract,
			WebInvoke(
				BodyStyle = WebMessageBodyStyle.Bare,
				ResponseFormat = WebMessageFormat.Json,
				UriTemplate = "/direct_messages/destroy/{messageId}.json")]
		DirectMessage Destroy(string messageId);
	}
}
